import axios from '@/libs/api.request'

const prefix = '/web/sportsTeam'
const TeamApi = {
  pageResult (trainCenter) {
    return axios.request({
      url: prefix + '/pageResult',
      data: trainCenter,
      method: 'post'
    })
  },
  save (trainCenter) {
    return axios.request({
      url: prefix + '/save',
      method: 'post',
      data: trainCenter
    })
  },
  update (trainCenter) {
    return axios.request({
      url: prefix + '/update',
      method: 'post',
      data: trainCenter
    })
  },
  delete (id) {
    console.log('删除：' + id)
    return axios.request({
      url: prefix + '/' + id,
      method: 'delete'
    })
  },
  unbind (trainCenterId, trainerId) {
    return axios.request({
      url: prefix + '/unbind/' + trainCenterId + '/' + trainerId,
      method: 'delete'
    })
  },
  userTrainCenterScope () {
    return axios.request({
      url: prefix + '/userTrainCenterScope',
      method: 'get'
    })
  },
  get (id) {
    return axios.request({
      url: prefix + '/' + id,
      method: 'get'
    })
  },
  getSportsPeople (id) {
    return axios.request({
      url: prefix + '/users/' + id,
      method: 'get'
    })
  },
  updateTrainerCoach (trainCenterId, trainerId, coachIds) {
    return axios.request({
      url: prefix + '/trainerCoach',
      data: { 'trainCenterId': trainCenterId, 'trainerId': trainerId, 'coachIds': coachIds },
      method: 'post'
    })
  },
  searchNotJoinedTrainers (data) {
    return axios.request({
      url: prefix + '/notJoinedTrainers/' + data['trainCenterId'],
      data: data,
      method: 'post'
    })
  },
  invite (trainCenterId, trainerId) {
    return axios.request({
      url: prefix + '/invite/' + trainCenterId + '/' + trainerId,
      method: 'post'
    })
  },
  getTrainerDetail (trainerId) {
    return axios.request({
      url: prefix + '/detail/' + trainerId,
      method: 'get'
    })
  }
}

export default TeamApi
